package net.xinqushi.design.bridge;

import java.util.ArrayList;
import java.util.List;

public class ProductBridge {

    private static List<Product> products = new ArrayList<Product>();

    static void addProduct(Product product){
        if(products.contains(product)) return;
        products.add(product);
    }

    public void sell(){
        for(Product product : products){ //已注册的就执行
            product.sell();
        }
    }

    public void pay(){
        for(Product product : products){ //已注册的就执行
            product.pay();
        }
    }

}
